<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width,user-scalable=no"name="viewport">
<title>充值</title>
</head>
	<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/customer/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/customer/css/base.css" />

	<link rel="stylesheet" type="text/css" href="{:C('WEB_URL')}Public/customer/css/style.css" />
	<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/customer/js/jquery-2.1.4.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/customer/js/bootstrap.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="{:C('WEB_URL')}Public/customer/js/script.js"></script>
	


</head>
<body>
<div id="box">
 <div class="navbar navbar-default navbar-fixed-top">
  <header>
   <h1><a href="index.html"><span class="glyphicon glyphicon-menu-left"></span></a></h1>
   <p class="title">充值</p>
  </header>
 </div><!--navbar-fixed-top-->
 <div class="rechar">
  <p>我的余额：{$data.balance}</p>
  <p>充值金额:</p>
  <div class="recharBox " id="recharBox" >
   <div class="recharLeft " abs="20">
   	<a href="#" class="">
     <p class="recharOne"><span>20</span>元</p>
	 <p class="recharTwo">偶尔用</p>
	</a>
   </div><!--recharLeft-->
   <div class="recharCenter" abs="50">
    <a href="#">
     <p class="recharOne"><span>50</span>元</p>
	 <p class="recharTwo">经常用</p>
	</a>
   </div><!--recharCenter-->
   <div class="recharRight" abs="100">
    <a href="#">
     <p class="recharOne"><span>100</span>元</p>
	 <p class="recharTwo">每天用</p>
	</a>
   </div><!--recharRight-->
   <empty name='ye'>
   
   <input type="hidden" name="xz" id="xz" value="20" />
   <else />

   <input type="hidden" name="xz" id="xz" value="{$ye}" />
   </empty>
   
  </div><!--recharBox-->
  <div class="rechMon">
   <p class="money" id='money1'><a href="#">自选金额（元）</a></p>
   <input  type="tel"  placeholder="请输入不小于10元的充值金额" id="money" />
  
  
   <p class="chong"  id="but"  >立即充值</p>

  </div><!--rechMon-->
     <div style="height:80px"></div>
 </div><!--rechar-->
 <div class="navbar navbar-default navbar-fixed-bottom">
   <footer>
    <dl>
     <dt><a href="{:U('index')}"><img src="{:C('WEB_URL')}Public/customer/images/home.png" /></a></dt>
     <dd><a href="{:U('index')}" class="current">首页</a></dd>
    </dl>
    <dl>
     <dt><a href="http://www.nleaves.com/qinqin/wechat/user/recommends?uid={$_SESSION[user_id]}"><img src="{:C('WEB_URL')}Public/customer/images/mores_17.jpg" /></a></dt>
     <dd><a href="http://www.nleaves.com/qinqin/wechat/user/recommends?uid={$_SESSION[user_id]}">推荐有奖</a></dd>
    </dl>
    <dl>
     <dt><a href="{:U('more')}"><img src="{:C('WEB_URL')}Public/customer/images/home-03.jpg" /></a></dt>
     <dd><a href="{:U('more')}">更多</a></dd>
    </dl>
   </footer>
  </div><!--/navbar-->
</div><!--box-->
<!--会员卡充值成功弹出页面 -->
 <a href="index.html" class="a_click" style="color: #666;"><div id="popup">
  <div id="click_div">
   <div id="dialog">
	<h3><img src="{:C('WEB_URL')}Public/customer/images/rechar_01.jpg" /></h3>
	<div class="dialogCont">恭喜您，充值成功！</div>
   </div><!--dialog-->
  </div>
 </div></a>
 <!--会员卡充值成功弹出页面 End-->
 <!--js验证弹出确认框-->
<!--<div class="clickBox" style="display: none;">
 <div class="clickOne">
  <p></p>
  <h4><a href="javascript:;" class="close_a">确认</a></h4>
 </div>
</div>-->
<!--js验证弹出确认框End-->
<script type="text/javascript">
//微信判断header是否显示
if(isWeiXin()){ 
//alert("====");
$(".title").hide();
} 
else{
//alert("+++++");
}	
//会员卡二维码弹出页面 JS
//$("#but").click(function(){
//	$("#click_div").show();
//})  
$("#money").val($("#xz").val());
$(".a_click").click(function(){
	$("#click_div").hide();
	
});


$("#recharBox div").click(function(){
	$("#recharBox div").removeClass('current');
	$(this).addClass('current');
	
	$("#xz").val($(this).attr('abs'));
	$("#money").val('');
//	alert($("#xz").val());
})

$("#money").focus(function(){
	
	$("#recharBox div").removeClass('current');
	$("#money1").addClass('rechar1');
})
$("#money").blur(function(){
	if($(this).val()<10){
		$(this).val(10);
	}
	if(isNaN($(this).val())){
		$(this).val(10);
		
	}
	$("#xz").val($(this).val());
		
})

$("#but").click(function(){
	var vars=$("#xz").val();
  // alert(vars);
	$.ajax({
		type:"post",
		url:"recharge",
		data:"money="+vars,
		datatype:'json',
		success:function(data){
			// console.log(data)
      if(data=='money'){
        alert('金额不能为空');   return;
      }
      alert('金额不能为空');   return;
			// $("#click_div").show();
      window.location.href='http://www.nleaves.com/qinqin/Wechat/Wxpay/js_api_call?order_sn='+data;
		}
	});
})
</script>
</body>
</html>
